package com.cn.lp.export.server.base.utils;

import org.apache.commons.lang3.tuple.*;

/**
 * 元组工具类, 超过三个参数就应该定义参数类
 */
public class TupleAide {

    /**
     * <p>Create a tuple of two elements.</p>
     *
     * @param value0
     * @param value1
     * @param <A>
     * @param <B>
     *
     * @return a tuple of two elements
     */
    public static <A, B> Pair<A, B> of(final A value0, final B value1) {
        return MutablePair.of(value0, value1);
    }

    /**
     * 不可变
     * <p>Create a tuple of two elements.</p>
     *
     * @param value0
     * @param value1
     * @param <A>
     * @param <B>
     *
     * @return a tuple of two elements
     */
    public static <A, B> Pair<A, B> immutableOf(final A value0, final B value1) {
        return ImmutablePair.of(value0, value1);
    }

    /**
     * <p>Create a tuple of three elements.</p>
     *
     * @param value0
     * @param value1
     * @param value2
     * @param <A>
     * @param <B>
     * @param <C>
     *
     * @return a tuple of three elements
     */
    public static <A, B, C> Triple<A, B, C> of(final A value0, final B value1, final C value2) {
        return MutableTriple.of(value0, value1, value2);
    }

    /**
     * 不可变
     * <p>Create a tuple of three elements.</p>
     *
     * @param value0
     * @param value1
     * @param value2
     * @param <A>
     * @param <B>
     * @param <C>
     *
     * @return a tuple of three elements
     */
    public static <A, B, C> Triple<A, B, C> immutableOf(final A value0, final B value1, final C value2) {
        return ImmutableTriple.of(value0, value1, value2);
    }

}
